package com.wjb.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wjb.pojo.entity.Orderx;
import org.apache.ibatis.annotations.*;


/**
 * @author : 王济彬
 * @date: 2025/5/24 - 05 - 24 - 16:09
 * @Description: com.wjb.mapper
 * @version: 1.0
 */
@Mapper
public interface ItemStockMapper extends BaseMapper<Orderx> {
    @Insert("INSERT INTO order (\n" +
            "            order_id, product_id, quantity, status, \n" +
            "            create_time, update_time\n" +
            "        ) VALUES (\n" +
            "            #{orderId}, #{productId}, #{quantity}, #{status},\n" +
            "            NOW(), NOW()\n" +
            "        )")
    int createOrder(Orderx orderx);

    @Select("select * from order where order_id = #{orderId}")
    Orderx getOrderById(String orderId);

    @Update("update order set status = #{status},update_time = NOW() \n" +
            "                           where order_id = #{orderId}")
    int updateOrderStatus(@Param("orderId") String orderId,@Param("status") String status);
}
